package com.zut.questionnaire.controller;

import com.zut.questionnaire.pojo.Answer;
import com.zut.questionnaire.pojo.AnswerSheet;
import com.zut.questionnaire.pojo.Result;
import com.zut.questionnaire.service.AnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("answer")
public class AnswerController {

    @Autowired
    private AnswerService answerService;

    @GetMapping("{id}")
    public Result findById(@PathVariable String id){

        return answerService.findById(id);
    }

    @PostMapping
    public Result save(@RequestBody Answer answer){

        return answerService.save(answer);
    }

    @PutMapping("{id}")
    public Result update(@PathVariable String id,@RequestBody Answer answer){

        return answerService.update(id,answer);
    }

    @DeleteMapping("{id}")
    public Result delete(@PathVariable String id){

        return answerService.delete(id);
    }
}
